<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@include file="../base/base.jspf" %>
<link rel="stylesheet" type="text/css" href="${ctx}/static/css/style.css"/>
<div class="layui-form" style="padding: 47px 0 0 70px;">
    <input type="hidden" name="semId" value="${setmeal.semId}"/>
    <div class="layui-col-xs6">
        <div class="layui-form-item">
            <label class="layui-form-label">套餐名称</label>
            <div class="layui-input-inline">
                <input type="text" value="${setmeal.semName}" name="semName" lay-verify="required"
                       placeholder="请输入套餐名称"
                       class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">数量</label>
            <div class="layui-input-inline">
                <input type="text" value="${setmeal.semNum}" name="semNum" lay-verify="required"
                       placeholder="请输入数量"class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">收费单位</label>
            <div class="layui-input-inline">
                <input type="radio" name="semUnit" value="1"  title="月"
                       <c:if test="${setmeal.semUnit == '1' || setmeal.semUnit == null}">checked</c:if>>
                <input type="radio" name="semUnit" value="2"  title="季"
                       <c:if test="${setmeal.semUnit == '2' }">checked</c:if>>
                <input type="radio" name="semUnit" value="3"  title="年"
                       <c:if test="${setmeal.semUnit == '3' }">checked</c:if>>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">收费费用</label>
            <div class="layui-input-inline">
                <input type="text" value="${setmeal.semMoney}" name="semMoney" lay-verify="required"
                       placeholder="请输入收费费用"class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">收费详情</label>
            <div class="layui-input-inline">
                <textarea name="semDesc" class="layui-textarea">${setmeal.semDesc}</textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit id="setmeal-front-submit" lay-filter="setmeal-front-submit" value="确认"/>
    </div>
</div>

<script type="text/javascript">
    layui.config({
        base: "${ctx}/static/framework/layuiadmin/" //静态资源所在路径
    }).extend({
        index: "lib/index" //主入口模块
    }).use(["index", "form","upload","laydate"], function () {
        var upload = layui.upload, form = layui.form,laydate = layui.laydate;

        form.on("submit(setmeal-front-submit)", function (data) {
            $("#setmeal-front-submit").attr("disabled", true);
            tip_index = load();
            var field = data.field; //获取提交的字段
            $.ajax({
                async: true,
                url: "${ctx}/setmeal/setmealSubmit",
                type: "post",
                dataType: "json",
                data: field,
                success: function (data) {
                    layer.close(tip_index);
                    if (data.result) {
                        parentTableReload("setmeal-setmealList-page");
                        successUp(data.info);
                        closeDialog();
                    } else {
                        $("#setmeal-front-submit").attr("disabled",false);
                        error(data.info);
                    }
                }
            });
        });

    });
</script>
